package org.summerframework.component.security.enumeration;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by shichao on 2017/7/18.
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum RegFromEnum {
    WEBSITE(0, "官网"), DYNAMIC_PSWD_FLOW(1, "快捷登录"), THIRD_PARTU(2, "第三方");

    private int type;
    private String code;

    RegFromEnum(int type, String code) {
        this.type = type;
        this.code = code;
    }

    public int getType() {
        return type;
    }

    public String getCode() {
        return code;
    }

    public static List<RegFromEnum> getList() {
        List<RegFromEnum> regFromEnums = new ArrayList<>();

        for (RegFromEnum sourceEnum : RegFromEnum.values()) {
            if (sourceEnum.type > -1) {
                regFromEnums.add(sourceEnum);
            }
        }

        return regFromEnums;
    }
}
